Sample Code

SoftwareShield System Feature Guide > Implementation Support > Sample Code

## Sample Code

There are six sample programs which ship with the SoftwareShield System DRM Kit, each written in six different languages and environments. All the sample programs can be found in the /SampleCode/ directory. Each language / environment has its own sub-directory. Each language has six (or seven) sub-directories, one for each of the programs in that language.

The original licenses for each of these programs can be found in the /SampleCode/ORIGINAL_LICENSES directory. More documentation about each of the programs can be found in-line in the code itself.

The sample programs are:

1. Simple Copy Protection. This program illustrates one of the simplest licensing implementations. Simply that the program will not be allowed to run until the Copy Protection is released. After which it will run without restriction.

2. Copy Protected with a 30 day trial. This program illustrates how you might combine Copy Protection with a trial period. Unlike the first program, if the Copy Protection is not released, but the trial period has not expired, the program is allowed to run. If the trial period has expired the program is not allowed to run. It also illustrates how you might use a Composite Authorization Definition to do two things with a single Activation Code (release the Copy Protection and release the trial period).

3. Copy Protected Pay Per Feature. This program illustrates how you might combine Copy Protection and General Use Authorization Definitions to implement an arbitrary licensing feature. In this case - we have the user buy one or more features. Again, we illustrate how you can use Composite Authorization Definitions to do multiple things with a single Activation Code.

4. Simple Copy Protection with CheckPoint. This program functions the same way as ’Simple Copy Protection”, but with the additional feature of the CheckPoint System. The program will not run till Copy Protection is release. This program allows two methods of releasing Copy Protection, automatic and manual. Manual is what you would normally see in the regular ”Simple Copy Protection” scheme. Automatic will allow you the release of Copy Protection through CheckPoint.

5. Copy Protected with a 30 day trial with CheckPoint. This program functions the same way as ”Copy Protected with a 30 day trial”, but with the additional feature of the CheckPoint System. The program will run properly until the trial period has expired. If the customer wishes to continue to use the program pass the trial period, the customer must release the program either manually or automatically. Manual will release the program the same way as ”Copy Protected with a 30 day trial”, whereas, automatically will release the program through CheckPoint.

6. Copy Protected Pay Per Feature with CheckPoint. This program functions the same way as ”Copy Protected Pay Per Feature”, but with the additional feature of the CheckPoint System. The program will have various features locked until it is released. The customer can buy features automatically or manually. Manual will release the feature the same way as ”Copy Protected Pay Per Feature”. Automatic will release the feature through CheckPoint.

Each of these programs is written in 6 languages / environments. The programs should compile and run without much configuration (if any) see below. This assumes you have installed the SoftwareShield DRM Kit in its default configuration with all options and have not moved the SSCProt.dll or unregistered it. The languages / environments and their special build considerations are:

1. Microsoft Visual Studio C++ 6. The workspace "samples.dsw" contains each of the six projects noted and should compile and run as-is.

2. Microsoft Visual Studio 2003 C#.NET. The solution "samples.sln" contains each of the six projects noted and should compile and run as-is.

3. Microsoft Visual Studio 2003 Visual Basic.NET. The solution "samples.sln" contains each of the six projects noted and should compile and run as-is.

4. Microsoft Visual Basic 6. Each of the individual projects should compile and run as-is.

5. Borland Delphi. There are seven projects in the Delphi project group "samples.bpg". When you load the project group - you may get warnings about an un-installed component. Click "Cancel" on any and all of these warnings if you get them. Do not click "Ignore". Once the group is loaded, switch to the package "ClientProtectorPak.bpl" Right-click it in the Project Manager and click "Build" then click "Install". Once the component is installed, each of the six projects should compile and run.

6. Borland C++ Builder. There are seven projects in the Builder project group "samples.bpg". When you load the project group - you may get warnings about an un-installed component. Click "Cancel" on any and all of these warnings if you get them. Do not click "Ignore". Once the group is loaded, switch to the package "ImportClientProtectorPak.bpl" Right-click it in the Project Manager and click "Build" then click "Install". Once the component is installed, each of the six projects should compile and run.